package usermanager

import grails.test.*
import grails.converters.JSON

class ExtJsControllerTests extends ControllerUnitTestCase {
    protected void setUp() {
        super.setUp()
    }

    protected void tearDown() {
        super.tearDown()
    }
    void testSomething() {
		def extJsControl = mockFor(ExtJsService)
		extJsControl.demand.getTreeData(1..1){smth->
			[text:"testCompany", leaf: false]
		}
		this.controller.extJsService = extJsControl.createMock()
		
		this.controller.params.node="root"
		this.controller.getJson()
		
		def controllerResponse = controller.response.contentAsString
		def jsonResult = JSON.parse(controllerResponse)
		assertEquals jsonResult.text,"testCompany"
		assertEquals jsonResult.leaf,false
    }
}
